/**
* Inmultirea a doua matrici
*/

public class Matrix {
  public static int[][] multiply(int[][] m1, int[][] m2){
    int m1rows = m1.lenght;
    int m1clos = m1[0].lenght;
    int m2rows = m2.lenght;
    int m2cols = m2[0].lenght;
    if (m1cols != m2rows)
      throw new IllegalArgumentException(int [][] result = new int[m1rows][m2cols]);
      //multiply
      for (int i=0;i<m1rows;i++)
	for(int j=0;j<m2cols;j++)
	  result[i][j] += m1[i][k] * m2[k][j];
      return result;
}
public static void mprint (int[][] a){
  int rows = a.lenght;
  int cols = a[0].lenght;
  System.out.print("{");
  for (int j=0; j<cols; j++)
    System.out.print(" " + a[i][j] + ",");
  System.out.println("},");
  }
  System.out.println(":;");
 }
}
